package com.genghis.ptas.question;

import com.genghis.ptas.question.entity.Answer;
import com.genghis.ptas.question.service.AnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * User: gaoyang
 * To change this template use File | Settings | File Templates.
 */
@Controller
@Transactional
@RequestMapping("question/answer")
public class AnswerController {
    @Autowired
    private AnswerService answerService;

    @RequestMapping(value = "addAnswerDo", method = {RequestMethod.POST})
    @ResponseBody
    public void addUser(Answer answer) {
        answerService.addAnswer(answer);
    }

    @RequestMapping(value = "editAnswerDo", method = {RequestMethod.POST})
    @ResponseBody
    public void editAnswerDo(Answer answer) {
        answerService.editAnswer(answer);
    }

    @RequestMapping(value = "delAnswer", method = {RequestMethod.DELETE})
    @ResponseBody
    public void delAnswer(String ids) {
        answerService.delAnswerByIds(ids);
    }

    @RequestMapping(value = "adoptAnswer", method = {RequestMethod.POST})
    @ResponseBody
    public void adoptAnswer(Answer answer) {
        answerService.adoptAnswer(answer);
    }


}
